snort3: replace complex sed calls with patch
authorJohn Audia <[email protected]>
Sun, 7 Sep 2025 11:28:36 +0000 (07:28 -0400)
committerHannu Nyman <[email protected]>
Wed, 10 Sep 2025 20:16:38 +0000 (23:16 +0300)
Simplification of Makefile: replace complex sed calls with a patch to
improve readability. This commit also renames an existing patch.

Signed-off-by: John Audia <[email protected]>
net/snort3/Makefile
net/snort3/patches/101-OpenWrt-package-modifications.patch [new file with mode: 0644]

index be286b61d4f79b6c623242a5079c4194ec7b8c9f..a010eefdec78ef77b12439660e329c8bc7e28c44 100644 (file)
@@ -105,22 +105,6 @@ define Package/snort3/install
 
        $(INSTALL_DIR) $(1)/etc/config
        $(INSTALL_CONF) ./files/snort.config $(1)/etc/config/snort
-       
-       sed \
-               -i \
-               -e "/^-- HOME_NET and EXTERNAL_NET/ i -- The values for the two variables HOME_NET and EXTERNAL_NET have been" \
-               -e "/^-- HOME_NET and EXTERNAL_NET/ i -- moved to /etc/config/snort, so do not modify them here without good" \
-               -e "/^-- HOME_NET and EXTERNAL_NET/ i -- reason.\n" \
-               -e 's/^\(HOME_NET\s\+=\)/--\1/g' \
-               -e 's/^\(EXTERNAL_NET\s\+=\)/--\1/g' \
-               $(1)/etc/snort/snort.lua
-       sed \
-               -i -e "s/^\\(RULE_PATH\\s\\+=\\).*/\\1 'rules'/g" \
-               -e "s/^\\(BUILTIN_RULE_PATH\\s\\+=\\).*/\\1 'builtin_rules'/g" \
-               -e "s/^\\(PLUGIN_RULE_PATH\\s\\+=\\).*/\\1 'so_rules'/g" \
-               -e "s/^\\(WHITE_LIST_PATH\\s\\+=\\).*/\\1 'lists'/g" \
-               -e "s/^\\(BLACK_LIST_PATH\\s\\+=\\).*/\\1 'lists'/g" \
-               $(1)/etc/snort/snort_defaults.lua
 endef
 
 $(eval $(call BuildPackage,snort3))
diff --git a/net/snort3/patches/101-OpenWrt-package-modifications.patch b/net/snort3/patches/101-OpenWrt-package-modifications.patch
new file mode 100644 (file)
index 0000000..3a0ee7d
--- /dev/null
@@ -0,0 +1,43 @@
+--- a/lua/snort.lua
++++ b/lua/snort.lua
+@@ -19,13 +19,17 @@
+ -- 1. configure defaults
+ ---------------------------------------------------------------------------
++-- The values for the two variables HOME_NET and EXTERNAL_NET have been
++-- moved to /etc/config/snort, so do not modify them here without good
++-- reason.
++
+ -- HOME_NET and EXTERNAL_NET must be set now
+ -- setup the network addresses you are protecting
+-HOME_NET = 'any'
++--HOME_NET = 'any'
+ -- set up the external network addresses.
+ -- (leave as "any" in most situations)
+-EXTERNAL_NET = 'any'
++--EXTERNAL_NET = 'any'
+ include 'snort_defaults.lua'
+--- a/lua/snort_defaults.lua
++++ b/lua/snort_defaults.lua
+@@ -19,13 +19,13 @@
+ ---------------------------------------------------------------------------
+ -- Path to your rules files (this can be a relative path)
+-RULE_PATH = '../rules'
+-BUILTIN_RULE_PATH = '../builtin_rules'
+-PLUGIN_RULE_PATH = '../so_rules'
++RULE_PATH = 'rules'
++BUILTIN_RULE_PATH = 'builtin_rules'
++PLUGIN_RULE_PATH = 'so_rules'
+ -- If you are using reputation preprocessor set these
+-WHITE_LIST_PATH = '../lists'
+-BLACK_LIST_PATH = '../lists'
++WHITE_LIST_PATH = 'lists'
++BLACK_LIST_PATH = 'lists'
+ ---------------------------------------------------------------------------
+ -- default networks - used in Talos rules